﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using Util;

namespace UI
{
    public partial class QuerryStocksPlaceForm : Form
    {
        Image im;
        int x = 0;
        int y = 0;

        public QuerryStocksPlaceForm(Image im)
        {
            InitializeComponent();
            this.im = im;
        }

        private void QuerryStocksPlaceForm_Load(object sender, EventArgs e)
        {
            this.pictureBox1.Image = im;
        }

        private void button3_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
        {
            if (!(x == e.X && y == e.Y))
            {
                x = e.X;
                y = e.Y;

                foreach (var item in Global.ListPlacePos)
                {
                    if (e.X > item.XMin && e.X < item.XMax && e.Y > item.YMin && e.Y < item.YMax)
                    {
                        ttMateriel.Active = true;
                        if (item.IsKnife)
                        {
                            ttMateriel.Show(string.Format("物料编码：{0}\r\n物料名称：{1}\r\n上模数量：{2}\r\n0.25数量：{3}\r\n0.5数量：{4}\r\n退料板数量：{5}", item.MaterielId, item.MaterielName, item.Count1, item.Count2, item.Count3, item.Count4), this.pictureBox1, x + 15, y + 15, 5000);
                        }
                        else
                        {
                            ttMateriel.Show(string.Format("物料编码：{0}\r\n物料名称：{1}\r\n数量：{2}", item.MaterielId, item.MaterielName, item.Count), this.pictureBox1, x + 15, y + 15, 5000);
                        }
                    }
                }
            }
        }
    }
}
